package com.ldp.designpatterns.study.chain;

import com.ldp.designpatterns.study.chain.concrete.DepartmentHeadHandler;
import com.ldp.designpatterns.study.chain.concrete.FinanceHandler;
import com.ldp.designpatterns.study.chain.concrete.ManagerHandler;
import com.ldp.designpatterns.study.chain.handler.ReimbursementHandler;
import com.ldp.designpatterns.study.chain.request.ReimbursementRequest;

/**
 * @ClassName ChainResponsibilityTest
 * @Description TODO
 * @Author lindipei
 * @Date 2023/10/18 17:25
 */
public class ChainResponsibilityTest {
    public static void main(String[] args) {
        ReimbursementHandler manager = new ManagerHandler();
        ReimbursementHandler departmentHead = new DepartmentHeadHandler();
        ReimbursementHandler finance = new FinanceHandler();

        manager.setSuccessor(departmentHead);
        departmentHead.setSuccessor(finance);

        ReimbursementRequest request1 = new ReimbursementRequest(800, "购买办公用品");
        ReimbursementRequest request2 = new ReimbursementRequest(3000, "参加培训");
        ReimbursementRequest request3 = new ReimbursementRequest(10000, "举办团建活动");

        manager.handleRequest(request1);
        manager.handleRequest(request2);
        manager.handleRequest(request3);
    }
}
